const path = require('path');
const autoprefixer = require('autoprefixer');
const pxtoviewport = require('postcss-px-to-viewport');
const scssFilePath = './src/assets/scss/global.scss'; 
const viewportConf = {
    // 视窗尺寸单位转换
    viewportWidth: 750,
    landscapeWidth: 1334,
    viewportUnit: 'vw'
}

module.exports = {
  outputDir: '/dist',

  pluginOptions: {
    
    // 自动导入全局scss
    'style-resources-loader': {
      'preProcessor': 'scss',
      'patterns': [
          path.resolve(__dirname, scssFilePath),
      ]
    }
  },

  css: {
    loaderOptions: {
      postcss: {
        plugins: [
          autoprefixer(),
          pxtoviewport(viewportConf)
        ]
      }
    }
  }
};